#pragma once

#include "stdafx.h"

//#ifdef USE_DIRECTX

class Canvas_D3D : public Blox::Canvas
{
public:
	struct InitData
	{
		HWND hWnd;
		UINT uWidth;
		UINT uHeight;
		UINT uFPS;
		u32 uTriBufferSize;
		u32 uLineBufferSize;
		u32 uModelBufferSize;
	};

	Canvas_D3D ( );
	virtual ~Canvas_D3D ( ) { }

	virtual bool Init ( void * pData );

	virtual void Clean ( );

	virtual void Render ( RenderPacket const & rPacket );

	virtual void DrawTri ( Blox::Vec const & v0, Blox::Vec const & v1, Blox::Vec const & v2, u32 c0, u32 c1, u32 c2 );

	virtual void DrawLine ( Blox::Vec const & v0, Blox::Vec const & v1, u32 c0, u32 c1 );

	virtual void DrawLine ( Blox::InputVert const & v0, Blox::InputVert const & v1 );


private:

	HRESULT InitInternal ( InitData const & rData );

private:

	// D3D Setup
	D3D10_DRIVER_TYPE			m_driverType;
	ID3D10Device *				m_pD3DDevice;
	IDXGISwapChain *			m_pSwapChain;
	ID3D10RenderTargetView *	m_pRenderTargetView;

	// Shader
	Effect *					m_pEffect_Basic;
	Technique *					m_pTechnique_DefaultRender;

	// Shader Vars
	ID3D10EffectMatrixVariable* m_pShaderWorld;
	ID3D10EffectMatrixVariable* m_pShaderView;
	ID3D10EffectMatrixVariable* m_pShaderProj;

	// Buffers
	VertexBuffer				m_TriBuffer;
	VertexBuffer				m_LineBuffer;
	VertexBuffer				m_ModelBuffer;

};

//#endif //USE_DIRECTX
